% relsize.sty       1.0       Jan 10, 1995

% New LaTex2e version by Donald Arseneau
% Original LaTex2.09 smaller.sty author: Bernie Cosell <cosell@WILMA.BBN.COM> 

% Relative font sizing in LaTeX

% commands are:
% \relsize{n}  where n gives the number of steps to change the size by;
%              n = -3 changes from \large to \footnotesize.
% \smaller == \relsize{-1}
% \larger  == \relsize{1}
% \textsmaller{text}, \textlarger{text} - versions that take an argument
% \mathsmaller{A}, \mathlarger{B}       - math versions 
%   (The math versions are quite different from the text versions.)

% There are more instructions at the end of the file (after \endinput).

\ProvidesPackage{relsize}[1995/01/10 ver 1.0]
\RequirePackage{exscale}

\DeclareRobustCommand\relsize[1]{%
\ifmmode \@nomath\relsize\else
 \@tempcnta % assign number representing current font size
   \ifx\@currsize\normalsize 4\else   % funny order is to have most ...
    \ifx\@currsize\small 3\else       % ...likely sizes checked first
     \ifx\@currsize\footnotesize 2\else
      \ifx\@currsize\large 5\else
       \ifx\@currsize\Large 6\else
        \ifx\@currsize\LARGE 7\else
         \ifx\@currsize\scriptsize 1\else
          \ifx\@currsize\tiny 0\else
           \ifx\@currsize\huge 8\else
            \ifx\@currsize\Huge 9\else
             4% unknown state: use \normalsize as starting point
 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
 \advance\@tempcnta#1\relax %  Change the number by the given increment
 \ifnum\@tempcnta<\z@ \@tempcnta\z@ \fi  % watch out for size underflow 
 \ifcase\@tempcnta  % set new size based on altered number
    \tiny \or \scriptsize \or \footnotesize \or \small \or \normalsize \or 
    \large \or \Large \or \LARGE \or \huge \else \Huge \fi
\fi
}
 
\newcommand\larger{\relsize{+1}}
\newcommand\smaller{\relsize{-1}}
\newcommand\textlarger[1]{{\relsize{+1}#1}}
\newcommand\textsmaller[1]{{\relsize{-1}#1}}
\newcommand\mathsmaller[1]{\mathchoice{{\textstyle#1}}{{\scriptstyle#1}}%
  {{\scriptscriptstyle#1}}{{\scriptscriptstyle#1}}}
\newcommand\mathlarger[1]{\mathchoice{\mbox{\larger$\displaystyle#1\m@th$}}%
  {{\displaystyle#1}}{{\textstyle#1}}{{\scriptstyle#1}}}


\endinput
==========================================================

R E L S I Z E . S T Y           ver 1.0   Jan 1995

by Donald Arseneau,  asnd@reg.triumf.ca,  based on smaller.sty by
Bernie Cosell, cosell@WILMA.BBN.COM.

It is frequently the case that something should be typeset somewhat larger
or smaller than the surrounding text, whatever that size happens to be.
Specifying such sizing commands explicitly makes it difficult to modify the
font sizes of a document at a later time, and makes it hard to write macros
that work at arbitrary sizes.  Relsize.sty defines several commands for LaTeX
to set font sizes relative to the current size. 

To refresh your memory, the font sizing commands in LaTeX are, in order:
\tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large,
\LARGE, \huge, \Huge.  The main new command provided is \relsize, which 
takes one (positive or negative) number as its argument; the number specifies
how many increments by which to change the font size.  For example, if  
{\relsize{-2} smaller}   appears in normal sized text, the word "smaller" 
is printed in footnote sized type.  If the same command appears in a \Large
section title, then "smaller" is printed in normal size. 

For convenience, there are the commands \smaller and \larger, which change
the font size by one increment in the obvious direction.  \large{\larger big}
prints "big" in \Large type.

All of the \relsize, \larger, and \smaller commands are "switches" just like
the regular sizing commands.  That is, they do not take an argument, but they 
change the size for all following text until the scope is ended by a closing 
brace.  There are alternate versions called \textlarger and \textsmaller that 
take some text as an argument and apply the size change to only that text:
\textlarger{big}.

All of the commands described above are text commands; they cannot be used in
math mode.  There are special \mathsmaller and \mathlarger commands provided, 
but these do not use the same sizes that the text versions use.  Instead, 
they step between the usual math "styles" which you can explicitly set
using the commands \textstyle, \scriptstyle, and \scriptscriptstyle [see
Lamport, 1st ed, p. 54].  The only time that the main font size is changed 
is when you use \larger in some display-style math.  The sizes selected are:

Current style        \mathsmaller gives      \mathlarger gives
---------------      ------------------      ----------------------------
displaystyle         \textstyle              \displaystyle in a \larger font
textstyle            \scriptstyle            \displaystyle 
scriptstyle          \scriptscriptstyle      \textstyle
scriptscriptstyle    \scriptscriptstyle      \scriptstyle

For example, try $\frac{\mathlarger{E}}{E}$.  Note that, for most symbols,
\displaystyle and \textstyle are the same size, so $N \mathlarger{N}$
gives two identical N's, but \sum and \int do get bigger in displays:
$\int\mathlarger{\int}$, and fractions are treated differently:
$\frac{1}{2} \mathlarger{\frac{1}{2}}$.  As you might have guessed,
\mathlarger and \mathsmaller should only be used in math mode.

Fine point:  The combination \relsize{n}\relsize{-n} is not guaranteed to 
restore the current font size!  That is because the increment "n" may be
enough to overflow the range of sizes.  Say you are in \huge text already,
and you do \relsize{4}.  There is nothing bigger than \Huge so that is the
size you get.  Then an ensuing \relsize{-4} will take four steps smaller
and change the size to \large.  The math mode commands are even less 
reversible: $\displaystyle\mathlarger{\mathsmaller{\sum_n}}$ prints the 
summation in the text style of a larger font.  Ugh!

You should use grouping to undo relative size changes.  It is unsafe to
counteract one change with an "equal" change in the opposite direction.

Donald Arseneau                         asnd@reg.triumf.ca
